set more off

* Change directory to one with "government_speech.dta"

* Figure 1
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==1
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(medium)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
replace medium="0" if medium=="billboard"
replace medium="1.5" if medium=="TM registration"
replace medium="3" if medium=="license plate"
replace medium="4.5" if medium=="statue"
destring(medium), replace
twoway (bar mean_govtspeech medium) ///
       (rcap hi_govtspeech lo_govtspeech medium), ///
       xlabel( 0 "billboard" 1.5 "trademark" 3 "license plate" 4.5 "statue in park", noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "Figure1.png", as(png) replace

* Figure 2
clear
use "government_speech.dta"
drop if scandalous==1 | billboard==1 | mturk==1
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(addedinfo)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
replace addedinfo ="0" if addedinfo =="none"
replace addedinfo ="1.5" if addedinfo =="private involvement"
replace addedinfo ="3" if addedinfo =="both"
replace addedinfo ="4.5" if addedinfo =="govt selectivity"
destring(addedinfo), replace
twoway (bar mean_govtspeech addedinfo) ///
       (rcap hi_govtspeech lo_govtspeech addedinfo), ///
       xlabel( 0 "none" 1.5 "private involvement" 3 "both" 4.5 "gov't selectivity", noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "Figure2.png", as(png) replace

* Figure 3
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==1
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(content)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
replace content ="-3.6" if content =="Mickey Mouse"
replace content ="-2.4" if content =="atheism"
replace content ="-1.2" if content =="Muslim"
replace content ="0" if content =="Ten Commandments"
replace content ="1.2" if content =="pro-choice"
replace content ="2.4" if content =="pro-life"
replace content ="3.6" if content =="Lincoln"
destring(content), replace
twoway (bar mean_govtspeech content) ///
       (rcap hi_govtspeech lo_govtspeech content), ///
       xlabel( -3.6 "Mickey" -2.4 "atheism" -1.2 "Muslim" 0 "Ten Cs" 1.2 "pro-choice" 2.4 "pro-life" 3.6 "Lincoln", noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "Figure3.png", as(png) replace

* Figure 4
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==1
drop if agree==-1 | agree==0 | agree==1
replace agree =-1.5 if agree ==-2
replace agree =0 if agree ==2
replace agree =1.5 if agree==3
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(agree)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
twoway (bar mean_govtspeech agree) ///
       (rcap hi_govtspeech lo_govtspeech agree), ///
       xlabel( -3 `""extremely" "negative""' -1.5 `""moderately" "negative""' 0 `""moderately" "positive""' 1.5 `""extremely" "positive""', noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "Figure4.png", as(png) replace

* Figure 5
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==1
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(question)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
replace question ="-1.5" if question =="associate"
replace question ="0" if question =="endorse"
replace question ="1.5" if question =="convey"
destring(question), replace
twoway (bar mean_govtspeech question) ///
       (rcap hi_govtspeech lo_govtspeech question), ///
       xlabel( -1.5 "associate w/ gov't?" 0 "gov't endorses?" 1.5 "conveys message?", noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "Figure5.png", as(png) replace
       
* Figure A1
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==0
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(medium)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
replace medium="0" if medium=="billboard"
replace medium="1.5" if medium=="TM registration"
replace medium="3" if medium=="license plate"
replace medium="4.5" if medium=="statue"
destring(medium), replace
twoway (bar mean_govtspeech medium) ///
       (rcap hi_govtspeech lo_govtspeech medium), ///
       xlabel( 0 "billboard" 1.5 "trademark" 3 "license plate" 4.5 "statue in park", noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "FigureA1.png", as(png) replace

* Figure A2
clear
use "government_speech.dta"
drop if scandalous==1 | billboard==1 | mturk==0
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(addedinfo)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
replace addedinfo ="0" if addedinfo =="none"
replace addedinfo ="1.5" if addedinfo =="private involvement"
replace addedinfo ="3" if addedinfo =="both"
replace addedinfo ="4.5" if addedinfo =="govt selectivity"
destring(addedinfo), replace
twoway (bar mean_govtspeech addedinfo) ///
       (rcap hi_govtspeech lo_govtspeech addedinfo), ///
       xlabel( 0 "none" 1.5 "private involvement" 3 "both" 4.5 "gov't selectivity", noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "FigureA2.png", as(png) replace

* Figure A3
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==0
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(content)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
replace content ="-3.6" if content =="Mickey Mouse"
replace content ="-2.4" if content =="atheism"
replace content ="-1.2" if content =="Muslim"
replace content ="0" if content =="Ten Commandments"
replace content ="1.2" if content =="pro-choice"
replace content ="2.4" if content =="pro-life"
replace content ="3.6" if content =="Lincoln"
destring(content), replace
twoway (bar mean_govtspeech content) ///
       (rcap hi_govtspeech lo_govtspeech content), ///
       xlabel( -3.6 "Mickey" -2.4 "atheism" -1.2 "Muslim" 0 "Ten Cs" 1.2 "pro-choice" 2.4 "pro-life" 3.6 "Lincoln", noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "FigureA3.png", as(png) replace

* Figure A4
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==0
drop if agree==-1 | agree==0 | agree==1
replace agree =-1.5 if agree ==-2
replace agree =0 if agree ==2
replace agree =1.5 if agree==3
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(agree)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
twoway (bar mean_govtspeech agree) ///
       (rcap hi_govtspeech lo_govtspeech agree), ///
       xlabel( -3 `""extremely" "negative""' -1.5 `""moderately" "negative""' 0 `""moderately" "positive""' 1.5 `""extremely" "positive""', noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "FigureA4.png", as(png) replace

* Figure A5
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==0
collapse (mean) mean_govtspeech=govtspeech (sd) sd_govtspeech=govtspeech (count) n=govtspeech, by(question)
generate hi_govtspeech = mean_govtspeech + invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
generate lo_govtspeech = mean_govtspeech - invttail(n-1,0.025)*(sd_govtspeech / sqrt(n))
replace question ="-1.5" if question =="associate"
replace question ="0" if question =="endorse"
replace question ="1.5" if question =="convey"
destring(question), replace
twoway (bar mean_govtspeech question) ///
       (rcap hi_govtspeech lo_govtspeech question), ///
       xlabel( -1.5 "associate w/ gov't?" 0 "gov't endorses?" 1.5 "conveys message?", noticks) ///
       ytitle("government speech") xtitle("") legend(off) graphregion(color(white))
graph export "FigureA5.png", as(png) replace

* Table A2
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==1
reg govtspeech statue plate tm, r
outreg2 using "SSI_reg.doc", replace
reg govtspeech statue plate tm lincoln prolife prochoice tenc muslim atheist convey endorse, r
outreg2 using "SSI_reg.doc", append
reg govtspeech statue plate tm lincoln prolife prochoice tenc muslim atheist convey endorse agree, r
outreg2 using "SSI_reg.doc", append
reg govtspeech statue plate tm lincoln prolife prochoice tenc muslim atheist convey endorse age female nonwhite liberal education, r
outreg2 using "SSI_reg.doc", append
reg govtspeech statue plate tm lincoln prolife prochoice tenc muslim atheist convey endorse agree age female nonwhite liberal education, r
outreg2 using "SSI_reg.doc", append

* Table A3
clear
use "government_speech.dta"
drop if scandalous==1 | mturk==0
reg govtspeech statue plate tm, r
outreg2 using "MTurk_reg.doc", replace
reg govtspeech statue plate tm lincoln prolife prochoice tenc muslim atheist convey endorse, r
outreg2 using "MTurk_reg.doc", append
reg govtspeech statue plate tm lincoln prolife prochoice tenc muslim atheist convey endorse agree, r
outreg2 using "MTurk_reg.doc", append
reg govtspeech statue plate tm lincoln prolife prochoice tenc muslim atheist convey endorse age female nonwhite liberal education, r
outreg2 using "MTurk_reg.doc", append
reg govtspeech statue plate tm lincoln prolife prochoice tenc muslim atheist convey endorse agree age female nonwhite liberal education, r
outreg2 using "MTurk_reg.doc", append
